package com.dondedesigns.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Helper {
	
	public String getMD5 (char[] message) {
		return getMD5(String.valueOf(message));
	}
	
	public String getMD5 (String message) {
		return getMD5(message.getBytes());
	}
	
	public String getMD5 (byte[] message) {
		try {
			MessageDigest md5Digest = MessageDigest.getInstance("MD5");
			md5Digest.update(message);
			return new BigInteger(1,md5Digest.digest()).toString(16);
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
			return null;
		}
	}
}
